<?php
class ORMOrderProduceEvent extends ORMBase {
  public function __construct() {
    parent::__construct('OrderProduceEvent');
  }

  public function __toEpObject($myManager, $epObject, $object) {
    require_once dirname(__FILE__) . '/ORMFile.class.php';
    $epObject->trackId = isset($object->trackId) ? $object->trackId : '';
    if (isset($epObject->images)) {
      $epObject->images->removeAll();
      foreach ($object->images as &$item) {
        $epObject->images[] = $this->__getEpObject_4_lvl_1_object($myManager, $item, new ORMFile(), 'File');
      }
    }
    $epObject->video = isset($object->video) ? $object->video : '';
    $epObject->date = isset($object->date) ? SimpleDate::toStamp($object->date) : 0;
    $epObject->change = isset($object->change) ? $object->change : '';
    $epObject->translate = isset($object->translate) ? $object->translate : '';
    return $epObject;
  }

  public function __toObject($myManager, $epObject, $object) {
    require_once dirname(__FILE__) . '/ORMFile.class.php';
    $object->id = $epObject->oid;
    $object->trackId = $epObject->trackId;
    $object->images = array();
    if (isset($epObject->images)) {
      foreach ($epObject->images as &$item) {
        $object->images[] = $this->__getObject_4_lvl_1_ep_object($myManager, $item, new ORMFile());
      }
    }
    $object->video = $epObject->video;
    $object->date = SimpleDate::fromStamp($epObject->date);
    $object->change = $epObject->change;
    $object->translate = $epObject->translate;
    return $object;
  }
}
?>
